package com.company.gas.service.impl;

import com.company.gas.mapper.FacilityMapper;
import com.company.gas.pojo.Facility;
import com.company.gas.service.IFacilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * @author: Li Guangdi
 *
 */
@Service

public class FacilityServiceImpl implements IFacilityService {

    @Autowired
    private FacilityMapper facilityMapper;

    @Override
    public List<Facility> queryFacilityList(){
        List<Facility> facilityList = facilityMapper.selectAll();
        return facilityList;
    }

    @Override
    public Facility queryFacilityById(String facId) {
        Facility facility =facilityMapper.queryFacilityById(facId);
        System.out.println(facility);
        return facility;
    }

    @Override
    public int addFacility(String facId,String facName,String baseId,Integer status,Integer flag,String createBy,String modifyBy) {
        facilityMapper.addFacility(facId,facName,baseId,status,flag,createBy,modifyBy);
        return 1;
    }

    @Override
    public int updateFacility(String facId,String facName,String baseId,Integer status,String modifyBy) {
        facilityMapper.updateFacility(facId,facName,baseId,status,modifyBy);
        return 1;
    }

    @Override
    public int deleteFacility(String facId) {
        facilityMapper.deleteFacility(facId);
        return 1;
    }
}
